using Refresh;
using UnityEngine;
using UnityEngine.Events;

/// <summary>
///     ������
///     ��������ͨ��������ٵ��ҵ����е��ӿؼ�
///     ���������������д����߼�
///     ��Լ�ҿؼ��Ĺ�����
///     orokana 2024/03/26
/// </summary>
public abstract class BasePanel : MonoBehaviour, IRefresh
{
    // ��ǰ������UI��������ʾUI��
    public bool isShow;

    private UnityAction hideCallBack;

    /// <summary>
    ///     ���UI�Ƿ��Ѿ������ù�һ��
    /// </summary>
    private bool isInit = false;


    protected virtual void Start()
    {
        Init();
    }


    public virtual void Refresh<T>(T data) where T : RefreshData<T>, new()
    {
    }

    /// <summary>
    ///     ��ʼ����������
    /// </summary>
    public abstract void Init();

    /// <summary>
    ///     Panel�Ѿ��򿪹�������£��ٴδ򿪵ķ���
    /// </summary>
    public abstract void ReOpen();


    /// <summary>
    ///     ��ʾ�Լ�
    /// </summary>
    public virtual void OpenPanel()
    {
        isShow = true;
    }

    /// <summary>
    ///     �����Լ�
    /// </summary>
    public virtual void ClosePanel(UnityAction callBack)
    {
        isShow = false;


        hideCallBack = callBack; // ������ϵ�ʱ��ִ��
    }
}